// sigaction_demo.c
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void sigHandler(int signum, siginfo_t *info, void *context) {
    printf("Received signal: %d, sent by PID: %d\n", signum, info->si_pid);
}

int main() {
    struct sigaction act;
    sigemptyset(&act.sa_mask);
    act.sa_sigaction = sigHandler;
    act.sa_flags = SA_SIGINFO;
    sigaction(SIGUSR1, &act, NULL);
    while (1) {
        sleep(1);
    }
    return 0;
}
